<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<div class="span9">
	<div class="well well-large">
		
		<c:if test="${not empty errors}">
			<c:forEach items="${errors}" var="error">
				<div class="alert alert-error">
					<button type="button" class="close" data-dismiss="alert">&times;</button>
					${error.message}
				</div>
			</c:forEach>
		</c:if>
		
   		<c:choose>
   			<c:when test="${empty chs}">
   			    <div class="alert alert-info">
			    	<button name="skipAjax" type="button" class="close" data-dismiss="alert">&times;</button>
			    	<h3><fmt:message key="BUNDLE_WARNING"/></h3> <fmt:message key="BUNDLE_EMPTY_CH"/>
			    </div>
   			</c:when>
   			<c:otherwise>
   				<table class="table table-bordered table-hover">
	   				<caption><h3> <fmt:message key="BUNDLE_CH"/> </h3></caption>
	   				<thead>
		   				<tr>
		   					<th><fmt:message key="BUNDLE_CONVENIO"/></th>
							<th><fmt:message key="BUNDLE_VALOR"/></th>
							<th><fmt:message key="BUNDLE_ACTIONS"/></th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${chs}" var="ch">
							<tr>
								<td>${ch.convenio.nome}</td>
								<td>${ch.valor}</td>
								<td>
									<a class="btn btn-small btn-primary" href="${pageContext.request.contextPath}/cH/${ch.id}/edit">
										<i class="icon-edit icon-white"></i> <fmt:message key="BUNDLE_EDIT"/>
									</a>
								</td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
   			</c:otherwise>
   		</c:choose>
	</div>
</div>

<div class="span3">
	<a class="btn btn-inverse" href="${pageContext.request.contextPath}/cH/new">
		<i class="icon-tag icon-white"></i> <fmt:message key="BUNDLE_NEW_CH"/>
	</a>
</div>